#include <windows.h>
#include <stdio.h>
#include <conio.h>
#include <stdlib.h>
#include <time.h>
#include <math.h>
int main()
{
	int x, y, a, b, fire, where;
	char input;
	where = 0;
	b = 12;//控制y坐标
	a = 20;//控制x坐标
	fire = 0;
	//system("mode con cols=80 lines=24");
	while (1)
	{
		//-----------------------------------------------------------------------------------------------------------------------------------------------
		system("cls");
		printf("[坐标 X:%d Y:%d] & [方向代号=%d] & [输出代号=%d]\n================================================================================", a, b, where, fire);
		//-----------------------------------------------------------------------------------------------------------------------------------------------
		for (y = 0; y <= (b - 2); y++)
		{
			for (x = 0; x < (a-1); x++)
			{
				printf("☆");
			}
			if (fire == 1 && where == 1)
			{
				printf("○");
			}
			printf("\n");
		}
		//-----------------------------------------------------------------------------------------------------------------------------------------------
		for (x = 0; x <= (a - 2); x++)
		{
			if (fire == 1 && where == 4)
			{
				printf("○");
			}
			else
			{
				printf("☆");
			}
		}
		printf("♀");
		for (x = 0; x <= (40-2-a); x++)
		{
			if (fire == 1 && where == 3)
			{
				printf("○");
			}
		}
		printf("\n");
		//-----------------------------------------------------------------------------------------------------------------------------------------------
		for (y = 0; y <= (19-b); y++)
		{
			for (x = 0; x <= (a-2); x++)
			{
				printf("☆");
			}
			if (fire == 1 && where == 2)
			{
				printf("○");
			}
			printf("\n");
		}
		printf("===============================================================================");
		//-----------------------------------------------------------------------------------------------------------------------------------------------
		fire = 0;
		input = _getch();
		if (input == 'w')
		{
			b--;
			where = 1;
			if (b < 1)
			{
				b = 1;
			}
		}
		else
		{
			if (input == 's')
			{
				b++;
				where = 2;
				if (b > 20)
				{
					b = 20;
				}
			}
			else
			{
				if (input == 'd')
				{
					a++;
					where = 3;
					if (a > 39)
					{
						a = 39;
					}
				}
				else
				{
					if (input == 'a')
					{
						a--;
						where = 4;
						if (a < 1)
						{
							a = 1;
						}
					}
					else
					{
						if (input == ' ')
						{
							fire = 1;
						}
					}
				}
			}
		}
		//-----------------------------------------------------------------------------------------------------------------------------------------------
		Sleep(10);
	}
	return 0;
}